<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>管理后台</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.4 -->

    <link href="/public/static/admin/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="/public/static/admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/public/static/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/public/static/admin/css/animate.css" rel="stylesheet">
    <link href="/public/static/admin/css/style.css?v=4.0.0" rel="stylesheet">
    <link href="/public/static/admin/css/ourstyle.css?v=4.0.0" rel="stylesheet">
    <link href="/public/static/admin/js/plugins/layer/skin/layer.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/public/webuploader/webuploader.css">

    <!-- 全局js -->
    <script src="/public/static/admin/js/jquery.min.js?v=2.1.4"></script> 
    <script src="/public/static/admin/js/bootstrap.min.js?v=3.3.5"></script>
    <!-- 自定义js -->
    <script src="/public/static/admin/js/content.js?v=1.0.0"></script>
    <script src="/public/static/admin/js/plugins/layer/layer.min.js"></script>
    <script src="/public/static/admin/plugins/laydate/laydate.js"></script>
    <script src="/public/static/admin/js/article.js"></script> 
    <!-- iCheck -->
    <script src="/public/static/admin/js/plugins/iCheck/icheck.min.js"></script>
    <!-- webuploader -->
     <script type="text/javascript" src="/public/webuploader/webuploader.nolog.js"></script>

</head>

<body class="fixed-sidebar full-height-layout gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>分类内容</h5>
                </div>
                <div class="ibox-content">
                    <div class="row">
                            <form action="{:url('Goods/addEditCategory')}" method="post" id="category_form" class="form-horizontal">
                                <div class="form-group" style="display: none;">
                                    <label class="control-label col-sm-2">显示名称</label>
                                    <div class="col-sm-8">
                                        <input type="text" placeholder="显示名称" class="form-control large" name="mobile_name" value="{$goods_category_info.mobile_name}">
                                        <span class="help-inline" style="color:#F00; display:none;" id="err_mobile_name"></span>
                                    </div>
                                </div> 
                                <div class="form-group">
                                    <label class="control-label col-sm-2">上级分类</label>
                                    <div class="col-sm-8">
                                        <select name="parent_id_1" id="parent_id_1"  class="small form-control">
                                            <option value="0">顶级分类</option>
                                            {foreach name="cat_list" item="v" }
                                                <option value="{$v[id]}">{$v[space]}{$v[name]}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                     <label class="col-sm-2 control-label">分类名称</label>
                                     <div class="col-sm-8">
                                        <input type="text" placeholder="名称" class="form-control large" name="name" value="{$goods_category_info.name}">
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-sm-2">分类图片</label>
                                    <div class="col-sm-8">
                                        <div class="input-group uploder-container">
                                            <input type="text" class="form-control" name="image" id="image" value="{$goods_category_info.image}" placeholder="请选择分类图片"> 
                                            <span class="input-group-btn"> <button type="button" class="btn btn-primary filePicker">选择图片</button>
                                            </span>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-sm-2">分类关键词</label>
                                    <div class="col-sm-8">
                                        <input type="text" placeholder="显示分类关键词" class="form-control large" name="keywords" value="{$goods_category_info.keywords}">
                                        <span class="help-inline" style="color:#F00; display:none;" id="err_keywords"></span>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-sm-2">分类描述词</label>
                                    <div class="col-sm-8">
                                        <input type="text" placeholder="显示分类描述词" class="form-control large" name="description" value="{$goods_category_info.description}">
                                        <span class="help-inline" style="color:#F00; display:none;" id="err_description"></span>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-2 control-label">关联属性组：</label>
                                    <div class="col-sm-8">
                                        <select class="form-control" name="attr_id">
                                            <option value="0">无关联</option>
                                            {volist name="attribute_kinds" id="attribute_kind"}
                                                <option value="{$attribute_kind.id}" {if $attribute_kind['id'] == $goods_category_info['attr_id']}selected=""{/if}>{$attribute_kind.name}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-sm-2">显示排序</label>
                                    <div class="col-sm-8">
                                        <input type="text" placeholder="50" class="form-control large" name="sort_order" value="{$goods_category_info.sort_order}">
                                        <span class="help-inline" style="color:#F00; display:none;" id="err_sort_order"></span>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-sm-2">是否显示</label>

                                    <div class="col-sm-8">
                                        <div class="col-sm-10">
                                            <label class="checkbox-inline i-checks">
                                                <input type="radio" name="is_show" value="1" {if $goods_category_info['is_show'] == 1}checked="checked"{/if}>是</label>
                                            <label class="checkbox-inline i-checks">
                                                <input type="radio" name="is_show" value="0" {if $goods_category_info['is_show'] == 0}checked="checked"{/if}>否</label>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-sm-2">分类简述</label>
                                    <div class="col-sm-8">
                                        <textarea  class="form-control large" name="cat_sketch" id="cat_sketch" >{$goods_category_info.cat_sketch} </textarea>
                                        <span class="help-inline" style="color:#F00; display:none;" id="err_cat_sketch"></span>
                                    </div>
                                </div>
                                
                                <div class="hr-line-dashed"></div>
                                <div class="form-group">
                                    <div class="col-sm-4 col-sm-offset-2">
                                        <input type="hidden" name="id" value="{$goods_category_info.id}">
                                        <button class="btn btn-primary" onclick="ajax_submit_form('category_form','{:url('Goods/addEditCategory?is_ajax=1')}')" type="button">保存</button>
                                    </div>
                                </div> 
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" src="/public/static/admin/js/webupload.js"></script>
<script>  
    
/** 以下是编辑时默认选中某个商品分类*/
$(document).ready(function(){
    $('.i-checks').iCheck({
        checkboxClass: 'icheckbox_square-green',
        radioClass: 'iradio_square-green',
    });

    {if $level_cat['2'] > 0} 
         // 如果当前是二级分类就让一级父id默认选中
         $("#parent_id_1").val('{$level_cat[1]}'); 
         get_category('{$level_cat[1]}','parent_id_2','0');      
    {/if}   
    {if $level_cat['3'] > 0}
         // 如果当前是三级分类就一级和二级父id默认 都选中
         $("#parent_id_1").val('{$level_cat[1]}');          
         get_category('{$level_cat[1]}','parent_id_2','{$level_cat[2]}');   
    {/if}


});
 
</script>
   
</body>
</html>